package com.neusoft.neuiotms.dcvm.converter;

import org.springframework.stereotype.Component;

import com.neusoft.bizcore.web.dto.AbstractConverter;
import com.neusoft.neuiotms.dcvm.dto.ModelVersionDTO;
import com.neusoft.neuiotms.dcvm.model.ModelVersion;

@Component
public class ModelVersionConverter extends AbstractConverter<ModelVersion, ModelVersionDTO> {

    @Override
    public ModelVersion toModel(ModelVersionDTO dto) {
        final ModelVersion model = new ModelVersion();
        model.setFileUrl(dto.getFileUrl());
        model.setFileName(dto.getFileName());
        model.setVersionCode(dto.getVersionCode());
        return model;
    }

    @Override
    public ModelVersionDTO toDTO(ModelVersion model, boolean forListView) {
        final ModelVersionDTO dto = new ModelVersionDTO();
        dto.setId(model.getId());
        dto.setFileUrl(model.getFileUrl());
        dto.setFileName(model.getFileName());
        dto.setVersionCode(model.getVersionCode());
        return dto;
    }

}
